﻿@model SDSystem.Models.Restaurant
@*//////////////////////////////////////////////////////////////////////Ext Form
@using Ext.Net
@using Ext.Net.MVC
@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@(Html.X().FormPanel()
      .ID("CreateRestaurantView")
      .BodyPadding(5)
          .Buttons(buttons =>
                       {
                           buttons.Add(
                               Html.X().Button().Text("Save").Icon(Icon.Disk).DirectEvents(
                                de =>
                                    {
                                        de.Click.IsUpload = true;
                                        de.Click.Confirmation.ConfirmRequest = true;
                                        de.Click.Confirmation.Title = "Save";
                                        de.Click.Confirmation.Message = "Confirm?";
                                        de.Click.Url = Url.Action("Create");
                                        de.Click.EventMask.ShowMask = true;
                                        de.Click.FormID = "CreateRestaurantView";
                                })
                               );
                           buttons.Add(
                               Html.X().Button().Text("Back").Icon(Icon.PreviousGreen)
                               );
                       })
      .Items(
          Html.X().FieldSet().Title("Restaurant Details").Layout(LayoutType.Form).Padding(5).Items(
              Html.X().TextFieldFor(m=>m.Name).FieldLabel("Restaurant Name").LabelWidth(100).Width(600).LabelAlign(LabelAlign.Top),
              Html.X().HtmlEditorFor(m => m.Description).FieldLabel("Description").Height(150).LabelWidth(100).LabelAlign(LabelAlign.Top),
              Html.X().FileUploadField().ID("imgUpload").FieldLabel("Upload Image").Text("Image Url").LabelWidth(100).Width(600).LabelAlign(LabelAlign.Top),
              Html.X().TextFieldFor(m=>m.Street).FieldLabel("Street").LabelWidth(100).Width(600).LabelAlign(LabelAlign.Top),
              Html.X().TextFieldFor(m=>m.City).FieldLabel("City").LabelWidth(100).Width(600).LabelAlign(LabelAlign.Top))))
//////////////////////////////////////////////////////////////////////////*@

@{
    ViewBag.Title = "Create Restaurant";
    Layout = "~/Views/Shared/_LayoutHtml.cshtml";
}
@using(Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Image)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Image,new {@id="ResImage"})
            @Html.ValidationMessageFor(model => model.Image)
            <input type="button" value="Browser..." id="btnImage"/>
            <script type="text/javascript">
                $(document).ready(function () {
                    $("#btnImage").click(function () {
                        var ckImage = new CKFinder();
                        ckImage.selectActionFunction = function (fileUrl) {
                            $("#ResImage").val(fileUrl);
                        };
                        ckImage.popup();
                    });
                });
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Description, new { @id = "descriptionCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("descriptionCk"
//                    ,{
//                        toolbar : 'Basic'
//                    }
                );
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.RContent)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.RContent, new { @id = "contentCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("contentCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Street)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Street)
            @Html.ValidationMessageFor(model => model.Street)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.City)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.City)
            @Html.ValidationMessageFor(model => model.City)
        </div>
        <br/>
        <p>
            <input type="submit" value="Create"/>
        </p>
    </fieldset>
}